.toc {
  background: #fff;
  overflow-y: auto;
  margin: -3px 0 0 -3px;
  max-height: calc(100vh - 50px);
  top: 30px;

  .search {
    width: calc(100% - 10px);
    margin: 5px 0 5px 10px;
    border-color: #ccc;

    &.active {
      border-color: $primary-color;
    }
  }

  .searchbox ul {
    width: calc(100% - 10px);
    margin-left: 10px;
  }

  .searchbox .tip {
    color: #888;
    font-size: .8em;
  }

  .searchbox li a {
    flex: 0 0 100%;
  }
}

@media all and (min-width: 700px) {
  .toc {
    padding: 0 10px 0 0;
    position: sticky;
  }
}

.toc h2 {
  font-size: 1.25em;
  margin-left: 0;
  padding: 0;
  margin-top: 0;
}

.toc h2 > *,
.toc a {
  display: block;
  color: inherit;
  padding: 0 10px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.toc .label {
  float: right;
  margin-top: 9px;
  margin-right: 2px;
}

.toc a {
  flex: 0 0 calc(100% - 35px);
}

.toc a.good::after,
.toc a.mid::after,
.toc a.bad::after {
  content: '';
  background: $picnic-success;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  float: right;
  margin: 10px 0 0 0;
  opacity: 0.4;
  position: absolute;
  right: 10px;
}

@media all and (min-width: 800px) {
  .toc a.good::after,
  .toc a.mid::after,
  .toc a.bad::after {
    margin: 12px 0 0 0;
  }
}

.toc li ul a.good::after,
.toc li ul a.mid::after,
.toc li ul a.bad::after {
  opacity: 0.2;
}

.toc a.mid::after {
  background: $picnic-warning;
}

.toc a.bad::after {
  background: $primary-color;
}

.toc a:hover {
  color: #0074d9;
  background: #eee;
}

.toc ul {
  padding: 0;
  margin: 0;
  list-style: none;
  position: relative;

  &.hidden {
    display: none;
  }
}

.toc > ul {
  margin-bottom: 50px;
}

.toc li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  line-height: 1.8;
  margin: .1em 0;
  flex-wrap: wrap;
}

.toc li li {
  margin-left: 45px;
  a {
    flex: 0 0 100%;
  }
}

.toc .more {
  // position: absolute;
  // left: 0;
  // top: 5px;
  flex: 0 0 30px;
  display: block;
  transition: all .3s ease;
  font-size: 30px;
  line-height: 24px;
  height: 30px;
  text-align: center;
  width: 30px;
  cursor: pointer;
  border-radius: 50%;
  transform-origin: 50% 50% 0;

  background-image: url('/img/chevron.svg');
  background-size: 18px 18px;
  background-repeat: no-repeat;
  background-position: 7px 6px;

  -moz-user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.toc .more:hover {
  color: #0074d9;
  background-color: #eee;
}

.toc .active > .more {
  transform: rotateZ(90deg);
}

.toc .more ~ ul {
  flex: 0 0 100%;
  max-height: 0;
  overflow: hidden;
  transition: all .3s ease;
}

.toc .active > .more ~ ul {
  max-height: 1000px;
}
